package com.iflytek.uoamp.agent.monitor.sender.config;


public class HostInfo {
	private final String referenceName;
	private final String hostName;
	private final int portNumber;
	private int hostWeight;
	private boolean isCanUse = true;

	public HostInfo(String referenceName, String hostName, int portNumber, int hostWeight) {
		this.referenceName = referenceName;
		this.hostName = hostName;
		this.portNumber = portNumber;
		this.hostWeight = hostWeight;
	}

	public synchronized boolean isCanUse() {
		return this.isCanUse;
	}

	public synchronized void setCanUse(boolean isCanUse) {
		this.isCanUse = isCanUse;
	}

	public String getReferenceName() {
		return referenceName;
	}

	public String getHostName() {
		return hostName;
	}

	public int getPortNumber() {
		return portNumber;
	}

	public int getHostWeight() {
		return hostWeight;
	}

	public void addWeight(int weight) {
		hostWeight += weight;
	}

	public String Identity() {
		return hostName + ":" + portNumber;
	}

	@Override
	public String toString() {
		return hostName + ":" + portNumber + ":" + hostWeight;
	}
}
